package www.openteam.com.bean;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by OT on 2018-01-09.
 */

public class IPQCMachine {

    /**
     * status : 1
     * info : 成功
     * data : {"data":[{"code":"1-A-11-399","name":"六色机5号"},{"code":"1-B-01-001","name":"五色机1号"},{"code":"1-B-02-001","name":"四色机1号"},{"code":"1-B-03-001","name":"四色机2号"},{"code":"1-B-03-155","name":"双面机3号"},{"code":"1-B-04-166","name":"双面机2号"},{"code":"1-B-05-187","name":"双面机5号"},{"code":"1-B-07-220","name":"六色机2号"},{"code":"1-B-08-002","name":"五色机2号"},{"code":"1-B-08-287","name":"五色机3号"},{"code":"1-B-09-332","name":"六色机3号"},{"code":"1-B-11-406","name":"双色机"},{"code":"1-B-13-484","name":"六色机1号"},{"code":"1-B-13-493","name":"海德堡UV双色机"},{"code":"1-B-15-888","name":"数码印刷机"}]}
     */

    private int status;
    private String info;
    private DataBeanX data;

    public static List<IPQCMachine> arrayIPQCMachineFromData(String str) {

        Type listType = new TypeToken<ArrayList<IPQCMachine>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public DataBeanX getData() {
        return data;
    }

    public void setData(DataBeanX data) {
        this.data = data;
    }

    public static class DataBeanX {
        private List<DataBean> data;

        public static List<DataBeanX> arrayDataBeanXFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBeanX>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public List<DataBean> getData() {
            return data;
        }

        public void setData(List<DataBean> data) {
            this.data = data;
        }

        public static class DataBean {
            /**
             * code : 1-A-11-399
             * name : 六色机5号
             */

            private String code;
            private String name;

            public static List<DataBean> arrayDataBeanFromData(String str) {

                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(str, listType);
            }

            public String getCode() {
                return code;
            }

            public void setCode(String code) {
                this.code = code;
            }

            public String getName() {
                return name;
            }

            public void setName(String name) {
                this.name = name;
            }
        }
    }
}
